
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    
<head>   
   

    <script type="text/javascript" src="http://c.csdnimg.cn/pubfooter/js/tracking.js" charset="utf-8"></script>  

    <script type="text/javascript">
        var protocol = window.location.protocol;
        document.write('<script type="text/javascript" src="' + protocol + '//csdnimg.cn/pubfooter/js/repoAddr2.js?v=' + Math.random() + '"></' + 'script>');
    </script>

  
 <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />

    <title>Android之Notification的多种用法 - 非著名程序员
        - 博客频道 - CSDN.NET</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="在Form1_Load事件中添加" />
    <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script>
      <script type="text/javascript" src="http://static.blog.csdn.net/scripts/jquery-version.js"></script>
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/ad.js?v=1.1"></script>
        <!--new top-->
               <link rel="stylesheet" href="http://c.csdnimg.cn/public/common/toolbar/css/index.css">        <!--new top-->
    
      <!-- ad begin -->
         <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/tracking.js"></script>
    <!-- ad end-->

    <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/light_blue/css/style.css?v=1.1" />
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="/loongggdroid/rss/list" />
    <link rel="shortcut icon" href="http://c.csdnimg.cn/public/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" />
 


<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?6bcd52f51e9b3dce32bec4a3997715ac";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

</head>
<body>
    <!-- 广告位开始 -->
        <ins data-revive-zoneid="149" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
    <!-- 广告位结束 -->

    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="http://c.csdnimg.cn/public/common/toolbar/js/html.js" type="text/javascript"></script>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/loongggdroid">非著名程序员</a></h2>
            <h3>求源码，请关注微信订阅号：非著名程序员（smart_android）。</h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
        
     
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>           
                <li id="btnContents"><a href="http://blog.csdn.net/loongggdroid?viewmode=contents"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_mulu'])">
                    <img src="http://static.blog.csdn.net/images/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/loongggdroid?viewmode=list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_zhaiyao'])">
                    <img src="http://static.blog.csdn.net/images/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/loongggdroid/rss/list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])">
                    <img src="http://static.blog.csdn.net/images/ico_rss.gif">订阅</span></a></li>                
            

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "loongggdroid";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/loongggdroid";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod='popu_3' > 
<a href="http://geek.csdn.net/news/detail/126445">
<font color=red>聚焦行业最佳实践，BDTC 2016完整议程公布
</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://huiyi.csdn.net/activity/product/goods_list?project_id=3287">
<font color=blue>微信小程序实战项目——点餐系统
</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/turingbooks/article/details/53079366">
<font color=red>程序员11月书讯，评论得书啦 
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://geek.csdn.net/news/detail/110921">
<font color=blue>Get IT技能知识库，50个领域一键直达
</font></a>


</font></a>
</font></a>
</div>                        </div>
                        


<!-- 广告位开始 -->
<ins data-revive-zoneid="72" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
<!-- 广告位结束 -->

  
<link href="http://static.blog.csdn.net/css/comment1.css" type="text/css" rel="stylesheet" />
<link href="http://static.blog.csdn.net/css/style1.css" type="text/css" rel="stylesheet" />
<script language='JavaScript' type='text/javascript' src='http://download.csdn.net/js/jquery.cookie.js'></script>
<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/search-service/main.js"></script>
<link rel="stylesheet" href="http://static.blog.csdn.net/public/res-min/markdown_views.css?v=1.0" />
<link rel="stylesheet" href="http://static.blog.csdn.net/css/category.css?v=1.0" />
<script type="text/javascript" src="http://static.blog.csdn.net/public/res/bower-libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/web-storage-cache.min.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/replace.min.js"></script>




  <script type="text/ecmascript">
      window.quickReplyflag = true;
           
            var isBole = false;
            
          
    </script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Original"></span>


    <h1>
        <span class="link_title"><a href="/loongggdroid/article/details/17616509">
        <font color="red">[置顶]</font>
        Android之Notification的多种用法            
        </a></span>
    </h1>
</div>

   

        <div class="article_manage clearfix">
        <div class="article_l">
            <span class="link_categories">
            标签：
              <a href='http://www.csdn.net/tag/notification' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">notification</a>
            </span>
        </div>
        <div class="article_r">
            <span class="link_postdate">2013-12-27 18:18</span>
            <span class="link_view" title="阅读次数">88190人阅读</span>
            <span class="link_comments" title="评论次数"> <a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(21)</span>
            <span class="link_collect tracking-ad" data-mod="popu_171"> <a href="javascript:void(0);" onclick="javascript:collectArticle('Android之Notification的多种用法','17616509');return false;" title="收藏">收藏</a></span>
             <span class="link_report"> <a href="#report" onclick="javascript:report(17616509,2);return false;" title="举报">举报</a></span>

        </div>
    </div>
    <div class="embody"  style="display:none" id="embody">
        <span class="embody_t">本文章已收录于：</span>
        <div class="embody_c" id="lib" value="{&quot;err&quot;:0,&quot;msg&quot;:&quot;ok&quot;,&quot;data&quot;:[]}"></div>
    </div>
    <style type="text/css">        
            .embody{
                padding:10px 10px 10px;
                margin:0 -20px;
                border-bottom:solid 1px #ededed;                
            }
            .embody_b{
                margin:0 ;
                padding:10px 0;
            }
            .embody .embody_t,.embody .embody_c{
                display: inline-block;
                margin-right:10px;
            }
            .embody_t{
                font-size: 12px;
                color:#999;
            }
            .embody_c{
                font-size: 12px;
            }
            .embody_c img,.embody_c em{
                display: inline-block;
                vertical-align: middle;               
            }
             .embody_c img{               
                width:30px;
                height:30px;
            }
            .embody_c em{
                margin: 0 20px 0 10px;
                color:#333;
                font-style: normal;
            }
    </style>
    <script  type="text/javascript">
        $(function () {
            try
            {
                var lib = eval("("+$("#lib").attr("value")+")");
                var html = "";
                if (lib.err == 0) {
                    $.each(lib.data, function (i) {
                        var obj = lib.data[i];
                        //html += '<img src="' + obj.logo + '"/>' + obj.name + "&nbsp;&nbsp;";
                        html += ' <a href="' + obj.url + '" target="_blank">';
                        html += ' <img src="' + obj.logo + '">';
                        html += ' <em><b>' + obj.name + '</b></em>';
                        html += ' </a>';
                    });
                    if (html != "") {
                        setTimeout(function () {
                            $("#lib").html(html);                      
                            $("#embody").show();
                        }, 100);
                    }
                }      
            } catch (err)
            { }
            
        });
    </script>
      <div class="category clearfix">
        <div class="category_l">
           <img src="http://static.blog.csdn.net/images/category_icon.jpg">
            <span>分类：</span>
        </div>
        <div class="category_r">
                    <label  onclick="GetCategoryArticles('1317893','loongggdroid','top','17616509');">
                        <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">android编程笔记<em>（47）</em></span>
                      <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;">
                      <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;">
                        <div class="subItem">
                            <div class="subItem_t"><a  href="http://blog.csdn.net/loongggdroid/article/category/1317893"  target="_blank">作者同类文章</a><i class="J_close">X</i></div>
                            <ul class="subItem_l" id="top_1317893">                            
                            </ul>
                        </div>
                    </label>                    
        </div>
    </div>
    <script   type="text/javascript" src="http://static.blog.csdn.net/scripts/category.js"></script>  
        <div   class="bog_copyright">         
            <p  class="copyright_p" >版权声明：本文为博主原创文章，未经博主允许不得转载。</p>
        </div>

  

  
  
     

<div id="article_content" class="article_content">

<p><span style="font-family:Microsoft YaHei; font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family:Microsoft YaHei; font-size:14px">我们在用手机的时候，如果来了短信，而我们没有点击查看的话，是不是在手机的最上边的状态栏里有一个短信的小图标提示啊？你是不是也想实现这种功能呢？今天的Notification就是解决这个问题的。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我们也知道Android系统也是在不断升级的，有关Notification的用法也就有很多种，有的方法已经被android抛弃了，现在我实现了三种不同的方法，并适应不同的android版本。现在我就把代码公布出来，我喜欢把解释写在代码中，在这里我就不多说了，先看效果图：</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"><img src="http://img.blog.csdn.net/20131227181443812?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbG9vbmdnZ2Ryb2lk/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""><img src="http://img.blog.csdn.net/20131227181451218?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbG9vbmdnZ2Ryb2lk/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""><img src="http://img.blog.csdn.net/20131227181459093?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbG9vbmdnZ2Ryb2lk/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px">再看代码，主要的代码如下：</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"></span></p>
<pre code_snippet_id="131010" snippet_file_name="blog_20131227_1_8404954"  code_snippet_id="131010" snippet_file_name="blog_20131227_1_8404954" name="code" class="java">package net.loonggg.notification;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RemoteViews;

public class MainActivity extends Activity {
	private static final int NOTIFICATION_FLAG = 1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	public void notificationMethod(View view) {
		// 在Android进行通知处理，首先需要重系统哪里获得通知管理器NotificationManager，它是一个系统Service。
		NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
		switch (view.getId()) {
		// 默认通知
		case R.id.btn1:
			// 创建一个PendingIntent，和Intent类似，不同的是由于不是马上调用，需要在下拉状态条出发的activity，所以采用的是PendingIntent,即点击Notification跳转启动到哪个Activity
			PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
					new Intent(this, MainActivity.class), 0);
			// 下面需兼容Android 2.x版本是的处理方式
			// Notification notify1 = new Notification(R.drawable.message,
			// &quot;TickerText:&quot; + &quot;您有新短消息，请注意查收！&quot;, System.currentTimeMillis());
			Notification notify1 = new Notification();
			notify1.icon = R.drawable.message;
			notify1.tickerText = &quot;TickerText:您有新短消息，请注意查收！&quot;;
			notify1.when = System.currentTimeMillis();
			notify1.setLatestEventInfo(this, &quot;Notification Title&quot;,
					&quot;This is the notification message&quot;, pendingIntent);
			notify1.number = 1;
			notify1.flags |= Notification.FLAG_AUTO_CANCEL; // FLAG_AUTO_CANCEL表明当通知被用户点击时，通知将被清除。
			// 通过通知管理器来发起通知。如果id不同，则每click，在statu那里增加一个提示
			manager.notify(NOTIFICATION_FLAG, notify1);
			break;
		// 默认通知 API11及之后可用
		case R.id.btn2:
			PendingIntent pendingIntent2 = PendingIntent.getActivity(this, 0,
					new Intent(this, MainActivity.class), 0);
			// 通过Notification.Builder来创建通知，注意API Level
			// API11之后才支持
			Notification notify2 = new Notification.Builder(this)
					.setSmallIcon(R.drawable.message) // 设置状态栏中的小图片，尺寸一般建议在24×24，这个图片同样也是在下拉状态栏中所显示，如果在那里需要更换更大的图片，可以使用setLargeIcon(Bitmap
														// icon)
					.setTicker(&quot;TickerText:&quot; + &quot;您有新短消息，请注意查收！&quot;)// 设置在status
																// bar上显示的提示文字
					.setContentTitle(&quot;Notification Title&quot;)// 设置在下拉status
															// bar后Activity，本例子中的NotififyMessage的TextView中显示的标题
					.setContentText(&quot;This is the notification message&quot;)// TextView中显示的详细内容
					.setContentIntent(pendingIntent2) // 关联PendingIntent
					.setNumber(1) // 在TextView的右方显示的数字，可放大图片看，在最右侧。这个number同时也起到一个序列号的左右，如果多个触发多个通知（同一ID），可以指定显示哪一个。
					.getNotification(); // 需要注意build()是在API level
			// 16及之后增加的，在API11中可以使用getNotificatin()来代替
			notify2.flags |= Notification.FLAG_AUTO_CANCEL;
			manager.notify(NOTIFICATION_FLAG, notify2);
			break;
		// 默认通知 API16及之后可用
		case R.id.btn3:
			PendingIntent pendingIntent3 = PendingIntent.getActivity(this, 0,
					new Intent(this, MainActivity.class), 0);
			// 通过Notification.Builder来创建通知，注意API Level
			// API16之后才支持
			Notification notify3 = new Notification.Builder(this)
					.setSmallIcon(R.drawable.message)
					.setTicker(&quot;TickerText:&quot; + &quot;您有新短消息，请注意查收！&quot;)
					.setContentTitle(&quot;Notification Title&quot;)
					.setContentText(&quot;This is the notification message&quot;)
					.setContentIntent(pendingIntent3).setNumber(1).build(); // 需要注意build()是在API
																			// level16及之后增加的，API11可以使用getNotificatin()来替代
			notify3.flags |= Notification.FLAG_AUTO_CANCEL; // FLAG_AUTO_CANCEL表明当通知被用户点击时，通知将被清除。
			manager.notify(NOTIFICATION_FLAG, notify3);// 步骤4：通过通知管理器来发起通知。如果id不同，则每click，在status哪里增加一个提示
			break;
		// 自定义通知
		case R.id.btn4:
			// Notification myNotify = new Notification(R.drawable.message,
			// &quot;自定义通知：您有新短信息了，请注意查收！&quot;, System.currentTimeMillis());
			Notification myNotify = new Notification();
			myNotify.icon = R.drawable.message;
			myNotify.tickerText = &quot;TickerText:您有新短消息，请注意查收！&quot;;
			myNotify.when = System.currentTimeMillis();
			myNotify.flags = Notification.FLAG_NO_CLEAR;// 不能够自动清除
			RemoteViews rv = new RemoteViews(getPackageName(),
					R.layout.my_notification);
			rv.setTextViewText(R.id.text_content, &quot;hello wrold!&quot;);
			myNotify.contentView = rv;
			Intent intent = new Intent(Intent.ACTION_MAIN);
			PendingIntent contentIntent = PendingIntent.getActivity(this, 1,
					intent, 1);
			myNotify.contentIntent = contentIntent;
			manager.notify(NOTIFICATION_FLAG, myNotify);
			break;
		case R.id.btn5:
			// 清除id为NOTIFICATION_FLAG的通知
			manager.cancel(NOTIFICATION_FLAG);
			// 清除所有的通知
			// manager.cancelAll();
			break;
		default:
			break;
		}
	}
}
</pre>再看主布局文件：
<p></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"></span></p>
<pre code_snippet_id="131010" snippet_file_name="blog_20131227_2_6354831"  code_snippet_id="131010" snippet_file_name="blog_20131227_2_6354831" name="code" class="html">&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;
    android:orientation=&quot;vertical&quot;
    tools:context=&quot;.MainActivity&quot; &gt;

    &lt;Button
        android:id=&quot;@+id/btn1&quot;
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:onClick=&quot;notificationMethod&quot;
        android:text=&quot;默认通知(已被抛弃，但是通用)&quot; /&gt;

    &lt;Button
        android:id=&quot;@+id/btn2&quot;
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:onClick=&quot;notificationMethod&quot;
        android:text=&quot;默认通知(API11之后可用)&quot; /&gt;

    &lt;Button
        android:id=&quot;@+id/btn3&quot;
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:onClick=&quot;notificationMethod&quot;
        android:text=&quot;默认通知(API16之后可用)&quot; /&gt;

    &lt;Button
        android:id=&quot;@+id/btn4&quot;
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:onClick=&quot;notificationMethod&quot;
        android:text=&quot;自定义通知&quot; /&gt;

    &lt;Button
        android:id=&quot;@+id/btn5&quot;
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:onClick=&quot;notificationMethod&quot;
        android:text=&quot;清除通知&quot; /&gt;

&lt;/LinearLayout&gt;</pre>还有一个是：自定义通知的布局文件my_notification.xml，代码如下:
<p></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"></span></p>
<pre code_snippet_id="131010" snippet_file_name="blog_20131227_3_7576330"  code_snippet_id="131010" snippet_file_name="blog_20131227_3_7576330" name="code" class="html">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:background=&quot;#ffffff&quot;
    android:orientation=&quot;vertical&quot; &gt;

    &lt;TextView
        android:id=&quot;@+id/text_content&quot;
        android:layout_width=&quot;wrap_content&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:textSize=&quot;20sp&quot; /&gt;

&lt;/LinearLayout&gt;</pre>转载请注明出处：http://blog.csdn.net/loongggdroid/article/details/17616509<br>
<p></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"><br>
</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:14px"><br>
</span></p>
   
</div>




<!-- Baidu Button BEGIN -->




<div class="bdsharebuttonbox tracking-ad" style="float: right;" data-mod="popu_172">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"  style="background-position:0 -52px !important"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"style="background-position:0 -104px !important"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"style="background-position:0 -260px !important"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"style="background-position:0 -208px !important"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"style="background-position:0 -1612px !important" ></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

   <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_detail.css" />

    
<!--172.16.140.14-->

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->

 

        <div id="digg" ArticleId="17616509" >
            <dl id="btnDigg" class="digg digg_disable"  onclick="btndigga();">
               
                 <dt>顶</dt>
                <dd>36</dd>
            </dl>
           
              
            <dl id="btnBury" class="digg digg_disable"  onclick="btnburya();">
              
                  <dt>踩</dt>
                <dd>0</dd>               
            </dl>
            
        </div>
     <div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" >&nbsp;</a>   </div>
    <div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" >&nbsp;</a></div>
    <script type="text/javascript">
                function btndigga() {
                    $(".tracking-ad[data-mod='popu_222'] a").click();
                }
                function btnburya() {
                    $(".tracking-ad[data-mod='popu_223'] a").click();
                }
            </script>

   <ul class="article_next_prev">
                <li class="prev_article"><span  onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/loongggdroid/article/details/17591977';">上一篇</span><a href="/loongggdroid/article/details/17591977" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian'])">通过学习制作长微博工具来了解水印的制作，及EditText中的内容在图片中换行显示</a></li>
                <li class="next_article"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/loongggdroid/article/details/17785109';">下一篇</span><a href="/loongggdroid/article/details/17785109" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian'])">Android学习记录（4）—在java中学习多线程下载的基本原理和基本用法①</a></li>
    </ul>

    <div style="clear:both; height:10px;"></div>


        <div class="similar_article"  style="display:none">
                <h4>我的同类文章</h4>
                <div class="similar_c"style="margin:20px 0px 0px 0px">
                    <div class="similar_c_t">
                                <label class="similar_cur">
                                    <span  style="cursor:pointer"  onclick="GetCategoryArticles('1317893','loongggdroid','foot','17616509');">android编程笔记<em>（47）</em></span>
                                </label>
                    </div>
                   
                    <div class="similar_wrap tracking-ad" data-mod="popu_141"  style="max-height:195px;">
                        <a href="http://blog.csdn.net" style="display:none">http://blog.csdn.net</a>
                        <ul class="similar_list fl">                          
                        </ul>

                        <ul class="similar_list fr">                           
                        </ul>
                    </div>
                </div>
            </div>    
    <script  type="text/javascript">
        $(function () {
            GetCategoryArticles('1317893', 'loongggdroid','foot','17616509');
        });
    </script>
      
</div>
<div id="suggest"></div>
         <script  language="javascript" type='text/javascript'>     
             $(function(){
                 $.get("/loongggdroid/svc/GetSuggestContent/17616509",function(data){
                     $("#suggest").html(data);
                 });     
             });             
         </script>  


<style>
.blog-ass-articl dd {
color: #369;
width: 99%; /*修改行*/
float: left;
overflow: hidden;
font: normal normal 12px/23px "SimSun";
height: 23px;
margin: 0;
padding: 0 0 0 10px;
margin-right: 30px;
background: url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;
}
</style>

 <link rel="stylesheet" href="http://static.blog.csdn.net/css/replace.css"/>
<div id="relate" data-mod="popu_218"  class="tracking-ad">
        <div class="relate_t">
            <h3><span>参考知识库</span></h3>
        </div>
        <div class="relate_c">
        </div>
</div>
 

<dl class="blog-ass-articl" id="res-relatived" > 
    <div class="embody embody_b" id="libkeyparent"  style="display:none">
            <span class="embody_t">更多资料请参考：</span>
            <div class="embody_c" id="libkey"></div>
    </div>


     <dt><span>猜你在找</span></dt>    


   


    <div id="adCollege" style="width: 42%;float: left;"> 
        <script src="http://csdnimg.cn/jobreco/job_reco.js" type="text/javascript"></script> 
        <script type="text/javascript">
            csdn.position.showEdu({
                sourceType: "blog",
                searchType: "detail",
                searchKey: "17616509",
                username: "",
                recordcount: "5",
                containerId: "adCollege" //容器DIV的id。 
            });
        </script> 
    </div>  

    
     <div id="res"  data-mod="popu_36"  class="tracking-ad" style="width: 42%;float: left;margin-right: 30px;"></div>
   
</dl>


<script type="text/javascript">
    $(function () {
        setTimeout(function () {
            var searchtitletags = 'Android之Notification的多种用法' + ',' + $("#tags").html();
            searchService({
                index: 'blog',
                query: searchtitletags,
                from: 5,
                size: 5,
                appendTo: '#res',
                url: 'recommend',
                his: 2,
                client: "blog_cf_enhance",
                tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
            });
        }, 500);
    });    

 </script>  

    <div id="ad_cen">        
                    <script type="text/javascript">
                        /*博客内容页下方Banner-728*90，创建于2014-7-3*/
                        var cpro_id = "u1607657";
                    </script>
                    <script type="text/javascript" src="http://cpro.baidustatic.com/cpro/ui/c.js"></script>
    </div>  

<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list">
    </div>
    <div id="comment_bar">
    </div>
    <div id="comment_form">
    </div>
    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '17616509';
    var commentscount = 21;
    var islock = false
</script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/comment.js"></script>
    <div id="ad_bot">
    </div>
<div id="report_dialog">
</div>

<div id="d-top"  style="bottom:60px;">
        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
        </a>    

    <a id="d-top-a" class="btn btn-top backtop"  style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])" style="">         
         <img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);    
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>


<div class="tag_list" style="display:none"></div>
  <script  language="javascript" type='text/javascript'>     
      $(function(){
              setTimeout(function(){
                  $.get("/loongggdroid/svc/GetTagContent",function(data){
                      $(".tag_list").html(data).show();
                  });     
              });
          },500);                       
 </script> 


<div id="pop_win" style="display:none ;position: absolute; z-index: 10000; border: 1px solid rgb(220, 220, 220); top: 222.5px; left: 630px; opacity: 1; background: none 0px 0px repeat scroll rgb(255, 255, 255);">
    
</div>
<div id="popup_mask"></div>
<style>
    #popup_mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        left: 0px;
        top: 0px;
        opacity: 0.3;
        filter: alpha(opacity=30);
        display: none;
    }

</style>




<script type="text/javascript">
    $(function(){
        setTimeout(function(){
            $(".comment_body:contains('回复')").each(function(index,item){
                var u=$(this).text().split('：')[0].toString().replace("回复","")
                var thisComment=$(this);
                if(u)
                {
                    $.getJSON("https://passport.csdn.net/get/nick?callback=?", {users: u}, function(a) {
                        if(a!=null&&a.data!=null&&a.data.length>0)
                        {
                            nick=a.data[0].n; 
                            if(u!=nick)
                            {
                                thisComment.text(thisComment.text().replace(u,nick));  
                            }
                        }       
                    });  
                }
            });         

        },200);  

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },5000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },10000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },15000);
        
        setTimeout(function(){
            $("a img[src='http://js.tongji.linezing.com/stats.gif']").parent().css({"position":"absolute","left":"50%"});
        },300);
    });

    function loginbox(){
        var $logpop=$("#pop_win");
        $logpop.html('<iframe src="https://passport.csdn.net/account/loginbox?service=http://static.blog.csdn.net/callback.htm" frameborder="0" height="600" width="400" scrolling="no"></iframe>');

        $('#popup_mask').css({
            opacity: 0.5,
            width: $( document ).width() + 'px',
            height:  $( document ).height() + 'px'
        });
        $('#popup_mask').css("display","block");
 
        $logpop.css( {
            top: ($( window ).height() - $logpop.height())/ 2  + $( window 
       ).scrollTop() + 'px',
            left:($( window ).width() - $logpop.width())/ 2
        } );
 
        setTimeout( function () {
            $logpop.show();
            $logpop.css( {
                opacity: 1
            } );
        }, 200 );
 
        $('#popup_mask').unbind("click");
        $('#popup_mask').bind("click", function(){
            $('#popup_mask').hide();
            var $clopop = $("#pop_win");
            $("#common_ask_div_sc").css("display","none");
            $clopop.css( {
                opacity: 0
            } );
            setTimeout( function () {
                $clopop.hide();
            }, 350 );
            return false;
        });
    }   

</script>
 <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/async_new.js"></script>      


                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
                   
           <div id="side">
               
    <div class="side">
<div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/loongggdroid" target="_blank">
    <img src="http://avatar.csdn.net/3/C/B/1_loongggdroid.jpg" title="访问我的空间" style="max-width:90%"/>
    </a>
    <br />
    <span><a href="http://my.csdn.net/loongggdroid" class="user_name" target="_blank">loongggdroid</a></span>
</div>
<div class="interact">

    <a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]"></a>

 <a href="javascript:void(0);" class="letter"  title="[发私信]" onclick="window.open('http://msg.csdn.net/letters/model?receiver=loongggdroid','_blank','height=350,width=700');_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_sixin'])"></a>  
</div>
<div id="blog_medal">
                       <div class="ico_expert"  onclick="javascript:location='http://blog.csdn.net/experts/rule.html'" title="CSDN认证专家" style="cursor:pointer;width:60px;height:60px;background:url('http://c.csdnimg.cn/jifen/images/xunzhang/xunzhang/bokezhuanjiamiddle.png') no-repeat" ></div>
                <div id="bms_box">
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>932249次</span></li>
    <li>积分：<span>6564</span> </li>    
    <li >等级： <span style="position:relative;display:inline-block;z-index:1" >
            <img src="http://c.csdnimg.cn/jifen/images/xunzhang/jianzhang/blog6.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：6564 </div>
        </span>  </li>
    <li>排名：<span>第2688名</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>105篇</span></li>
    <li>转载：<span>16篇</span></li>
    <li>译文：<span>3篇</span></li>
    <li>评论：<span>401条</span></li>
</ul>
</ul>
</div>


<div class="panel" id="panel_Search">
    <ul class="panel_head"><span>文章搜索</span></ul>
    <ul class="panel_body">
        <form id="frmSearch" action="http://so.csdn.net/search" class="form_search" target="_blank">
        <span><input id="inputSearch" type="text" class="blogsearch" title="请输入关键字" /></span>
        <input id="btnSubmit" type="button" value="搜索" title="search in blog" />
        <input type="hidden" name="q" id="inputQ" />
        <input type="hidden" name="t" value="blog" />
        <a id="btnSearchBlog" target="_blank"></a>
        </form>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        $("#btnSubmit").click(function () {           
            search();
        });

        $("#frmSearch").submit(function () {
            search();
            return false;
        });

        function search()
        {
            var url = "http://so.csdn.net/so/search/s.do?q=" + encodeURIComponent($("#inputSearch").val()) + "&u=" + username + "&t=blog";
            window.location.href = url;
        }   
    });
</script>

<div id="custom_column_40468719" class="panel">
<ul class="panel_head"><span>联系方式</span></ul>
<ul class="panel_body">

新浪微博：<font color="red" face="georgia"><a href="http://weibo.com/xiongmaoxiamaoxiong" target="_blank">@涩郎</a></font>
<br>
<br>
QQ邮箱：<font color="red" face="georgia"><a target="_blank" href="mailto:loonggg.android@foxmail.com">loonggg</a></font>
<br>
<br>
我的微信：<img title="我的微信 ^_^" border="0" alt="weixin" src="http://img.blog.csdn.net/20151116214016702" style="height:150px">
<br>
<br>
微信订阅号：<img title="我的微信订阅号 ^_^" border="0" alt="weixin" src="http://img.blog.csdn.net/20151116214001104" style="height:150px">
<br>

</ul>
</div><div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">    
                 <li>
                    <a href="/loongggdroid/article/category/1150066" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--UI设计</a><span>(30)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1155826" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--View</a><span>(21)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1159857" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--Thread</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1159858" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--Activity</a><span>(4)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1159862" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--Animation</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1317891" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">android编程技巧</a><span>(8)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1317893" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">android编程笔记</a><span>(48)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1318268" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android-service</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1320668" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">java</a><span>(6)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1322122" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android-反编译</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1323978" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">java常见面试题</a><span>(7)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1325015" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">移动开发新闻</a><span>(4)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1525241" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android--Fragment</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1820515" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">android学习记录</a><span>(24)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/1891977" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android疑难解析</a><span>(3)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/5610905" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android开发研究</a><span>(4)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/5956785" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">IT人生</a><span>(6)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/6213085" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">写作工具</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/loongggdroid/article/category/6486439" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">RN技术系列</a><span>(5)</span>
                </li>
</ul>
</div><div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list">
<!--归档统计-->
<li><a href="/loongggdroid/article/month/2016/11">2016年11月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2016/10">2016年10月</a><span>(2)</span></li><li><a href="/loongggdroid/article/month/2016/07">2016年07月</a><span>(5)</span></li><li><a href="/loongggdroid/article/month/2016/06">2016年06月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2016/05">2016年05月</a><span>(5)</span></li><li><a href="/loongggdroid/article/month/2016/02">2016年02月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2016/01">2016年01月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2015/12">2015年12月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2015/11">2015年11月</a><span>(5)</span></li><li><a href="/loongggdroid/article/month/2015/10">2015年10月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2015/09">2015年09月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2015/08">2015年08月</a><span>(7)</span></li><li><a href="/loongggdroid/article/month/2015/07">2015年07月</a><span>(7)</span></li><li><a href="/loongggdroid/article/month/2015/06">2015年06月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2014/11">2014年11月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2014/06">2014年06月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2014/05">2014年05月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2014/04">2014年04月</a><span>(2)</span></li><li><a href="/loongggdroid/article/month/2014/03">2014年03月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2014/02">2014年02月</a><span>(4)</span></li><li><a href="/loongggdroid/article/month/2014/01">2014年01月</a><span>(14)</span></li><li><a href="/loongggdroid/article/month/2013/12">2013年12月</a><span>(7)</span></li><li><a href="/loongggdroid/article/month/2013/11">2013年11月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2013/10">2013年10月</a><span>(2)</span></li><li><a href="/loongggdroid/article/month/2013/09">2013年09月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2013/08">2013年08月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2013/07">2013年07月</a><span>(9)</span></li><li><a href="/loongggdroid/article/month/2013/01">2013年01月</a><span>(18)</span></li><li><a href="/loongggdroid/article/month/2012/12">2012年12月</a><span>(1)</span></li><li><a href="/loongggdroid/article/month/2012/06">2012年06月</a><span>(3)</span></li><li><a href="/loongggdroid/article/month/2012/05">2012年05月</a><span>(5)</span></li>
</div>
</ul>
</div>
<div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="/loongggdroid/article/details/17616509" title="Android之Notification的多种用法">Android之Notification的多种用法</a><span>(88172)</span>
</li>
<li>
<a href="/loongggdroid/article/details/9385535" title="Android中ListView下拉刷新的实现">Android中ListView下拉刷新的实现</a><span>(84245)</span>
</li>
<li>
<a href="/loongggdroid/article/details/21166563" title="在Android中显示GIF动画">在Android中显示GIF动画</a><span>(63811)</span>
</li>
<li>
<a href="/loongggdroid/article/details/47037413" title="Android Studio之gradle的配置与介绍">Android Studio之gradle的配置与介绍</a><span>(63661)</span>
</li>
<li>
<a href="/loongggdroid/article/details/17515113" title="通过重写ViewGroup学习onMeasure()和onLayout()方法">通过重写ViewGroup学习onMeasure()和onLayout()方法</a><span>(51363)</span>
</li>
<li>
<a href="/loongggdroid/article/details/9469935" title="用Fragment实现如新浪微博一样的底部菜单的切换">用Fragment实现如新浪微博一样的底部菜单的切换</a><span>(43314)</span>
</li>
<li>
<a href="/loongggdroid/article/details/47417233" title="Android学习第八弹之改变状态栏的颜色使其与APP风格一体化">Android学习第八弹之改变状态栏的颜色使其与APP风格一体化</a><span>(41704)</span>
</li>
<li>
<a href="/loongggdroid/article/details/19970523" title="有关ViewPager使用及解决ViewPager和PagerAdapter中调用notifyDataSetChanged失效问题">有关ViewPager使用及解决ViewPager和PagerAdapter中调用notifyDataSetChanged失效问题</a><span>(37935)</span>
</li>
<li>
<a href="/loongggdroid/article/details/41485697" title="Android字体大小怎么自适应不同分辨率？">Android字体大小怎么自适应不同分辨率？</a><span>(28406)</span>
</li>
<li>
<a href="/loongggdroid/article/details/9789261" title="Android学习笔记（三）之带有侧边索引的快速查找（跟带字母索引查找的通讯录差不多）">Android学习笔记（三）之带有侧边索引的快速查找（跟带字母索引查找的通讯录差不多）</a><span>(21570)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="/loongggdroid/article/details/9789261" title="Android学习笔记（三）之带有侧边索引的快速查找（跟带字母索引查找的通讯录差不多）">Android学习笔记（三）之带有侧边索引的快速查找（跟带字母索引查找的通讯录差不多）</a><span>(71)</span>
</li>
<li>
<a href="/loongggdroid/article/details/9469935" title="用Fragment实现如新浪微博一样的底部菜单的切换">用Fragment实现如新浪微博一样的底部菜单的切换</a><span>(50)</span>
</li>
<li>
<a href="/loongggdroid/article/details/21166563" title="在Android中显示GIF动画">在Android中显示GIF动画</a><span>(47)</span>
</li>
<li>
<a href="/loongggdroid/article/details/9385535" title="Android中ListView下拉刷新的实现">Android中ListView下拉刷新的实现</a><span>(43)</span>
</li>
<li>
<a href="/loongggdroid/article/details/17616509" title="Android之Notification的多种用法">Android之Notification的多种用法</a><span>(21)</span>
</li>
<li>
<a href="/loongggdroid/article/details/35572269" title="Android系统自带分享功能的实现（可同时分享文字和图片）">Android系统自带分享功能的实现（可同时分享文字和图片）</a><span>(15)</span>
</li>
<li>
<a href="/loongggdroid/article/details/12304695" title="Android获取SD卡总容量，可用大小，机身内存总容量及可用大小的系统方法">Android获取SD卡总容量，可用大小，机身内存总容量及可用大小的系统方法</a><span>(14)</span>
</li>
<li>
<a href="/loongggdroid/article/details/12288379" title="Android学习笔记（四）之碎片化Fragment实现仿人人客户端的侧边栏">Android学习笔记（四）之碎片化Fragment实现仿人人客户端的侧边栏</a><span>(13)</span>
</li>
<li>
<a href="/loongggdroid/article/details/17515113" title="通过重写ViewGroup学习onMeasure()和onLayout()方法">通过重写ViewGroup学习onMeasure()和onLayout()方法</a><span>(9)</span>
</li>
<li>
<a href="/loongggdroid/article/details/17846085" title="Android学习记录（6）—将java中的多线程下载移植到Android中③">Android学习记录（6）—将java中的多线程下载移植到Android中③</a><span>(8)</span>
</li>
</ul>
</div>
<div id="homepageArticles" class="panel tracking-ad" data-mod="popu_4">
<ul class="panel_head"><span>推荐文章</span></ul>
<ul class="panel_body" id="ad_commend">
<ul>
<li><a href="http://blog.csdn.net/yyh352091626/article/details/53304728" target="_blank">* RxJava详解，由浅入深</a></li>
<li><a href="http://blog.csdn.net/foruok/article/details/53063089" 
target="_blank">* 倍升工作效率的小策略</a></li>
<li><a href="http://blog.csdn.net/jiangwei0910410003/article/details/53099390" 
target="_blank">* Android热修复框架AndFix原理解析及使用</a></li>
<li><a href="http://blog.csdn.net/xiangzhihong8/article/details/53312278" target="_blank">* “区块链”究竟是什么鬼</a></li>
<li><a href="http://blog.csdn.net/yinwenjie/article/details/53033017" 
target="_blank">* 架构设计：系统存储-MySQL主从方案业务连接透明化（中）</a></li>


</ul></ul>
</div>


<div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="/loongggdroid/article/details/17616509#comments">Android之Notification的多种用法</a>
    <p style="margin:0px;"><a href="/qq_25827845" class="user_name">qq_25827845</a>:
xuexile
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/47417233#comments">Android学习第八弹之改变状态栏的颜色使其与APP风格一体化</a>
    <p style="margin:0px;"><a href="/u013340999" class="user_name">u013340999</a>:
源码
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/25035059#comments">Android保持屏幕常亮唤醒状态</a>
    <p style="margin:0px;"><a href="/u013936108" class="user_name">u013936108</a>:
布局里面添加代码android:keepScreenOn=&quot;true&quot;或者初始化布局前加getWin...
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/51442097#comments">通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout</a>
    <p style="margin:0px;"><a href="/mchaoliu" class="user_name">mchaoliu</a>:
我开始就用的你这个方法，但是每次进去都会卡一两秒，有更好的办法吗，这个效果真的很好。很想学会
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/52033663#comments">Android Material Design系列之主题样式介绍说明等</a>
    <p style="margin:0px;"><a href="/u010042660" class="user_name">u010042660</a>:
大神能 把 对话框的按钮颜色和对话框的选择框颜色改了吗？其他都可以 唯独那个我就是概不了啊。看了半天...
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/9385535#comments">Android中ListView下拉刷新的实现</a>
    <p style="margin:0px;"><a href="/u013045211" class="user_name">u013045211</a>:
空白问题解决加上 android:overScrollMode=&quot;never&quot;即可
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/9385535#comments">Android之Notification的多种用法</a>
    <p style="margin:0px;"><a href="/jingjc" class="user_name">jingjc</a>:
@x359981514:这个不是通知到来的时候显示吗
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/18262543#comments">有关ViewFlipper的使用及设置动画效果的讲解</a>
    <p style="margin:0px;"><a href="/qq_22183239" class="user_name">qq_22183239</a>:
少了一些控件和一些anim
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/18262543#comments">通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout</a>
    <p style="margin:0px;"><a href="/loongggdroid" class="user_name">loongggdroid</a>:
@mchaoliu:https://github.com/loonggg/CoordinatorLa...
    </p>
    </li>
    <li>
   
         <a href="/loongggdroid/article/details/18262543#comments">通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout</a>
    <p style="margin:0px;"><a href="/loongggdroid" class="user_name">loongggdroid</a>:
https://github.com/loonggg/CoordinatorLayoutDemo，看...
    </p>
    </li>
</ul>
</div>
    </div>
    <div class="clear">
    </div>


                   <!-- 广告位开始 --> 
                    <ins data-revive-zoneid="190" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins> 
                    <!-- 广告位结束 -->

           </div>   

            <div class="clear">
            </div>
        </div>

        

<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/cnick/cnick.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script>


<script type="text/javascript" src="http://medal.blog.csdn.net/showblogmedal.ashx?blogid=1301421"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/JavaScript1.js"></script>

    <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script>
<script type="text/javascript" src="http://www.csdn.net/ui/scripts/Csdn/counter.js"></script>
<script type="text/javascript" src="http://ad.csdn.net/scripts/ad-blog.js"></script>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<span class='tracking-ad' data-mod='popu_167'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a></span>"
                    + "<span class='tracking-ad' data-mod='popu_170'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a></span>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });

        $(".bar").show();
    });
</script>





    </div>
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnId="header_notice_num" wrapId="note1" count="5" subCount="5" type="text/javascript" src="http://c.csdnimg.cn/public/common/toolbar/js/toolbar.js"></script>     <!--new top-->
   
    <link href="http://c.csdnimg.cn/comm_ask/css/ask_float_block.css" type="text/css" rel="stylesheet" />
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/wmd.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/showdown.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/prettify.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/apps/ask_float_block.js'></script>
   

  <div id="a52b5334d" style="width: 1px; height: 1px; display: none;">
                    <script id="adJs52b5334"></script>
                    <script>document.getElementById("adJs52b5334").src = "http://ads.csdn.net/js/opt/52b5334.js?t=" + Math.random();</script>
   </div>

    <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_code.css" />
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/saveToCode.js"></script>
      <script type="text/javascript" src="//csdnimg.cn/rabbit/tracking-ad/main.js?75eacd8"></script>
</body>
</html>   
 